package com.seckill.page.controller;

import com.seckill.goods.pojo.Sku;
import com.seckill.page.service.PageService;
import com.seckill.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class PageController {

    @Autowired
    private PageService pageService;
    /****
     * 删除商品详情页
     */
    @DeleteMapping(value = "/page/html/{id}")
    public Result delHtml(@PathVariable(value = "id")String id){
     return null;
    }

    /****
     * 静态页生成
     */
    @PostMapping(value = "/page/html")
    public Sku html(@RequestBody Sku sku){
       return pageService.html(sku);

    }

    /**
     * 批量生成静态页
     */
    @PostMapping(value = "/page/html/batch")
    public List<Sku> batchHtml(@RequestBody List<Sku> skus) throws InterruptedException {
        return pageService.batchHtml(skus);
    }

    /****
     * 静态页生成
     */
    @GetMapping(value = "/page/html/{id}")
    public Result html(@PathVariable(value = "id")String id){
        return pageService.html(id);
    }
}
